package com.ddone.controller;

import com.ddone.service.OrderService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author ddone
 * @date 2024/4/6-15:35
 */
@RestController
@RequestMapping("/order")
public class OrderController {

    @Resource
    private OrderService orderService;


    @GetMapping("/{userId}/{productId}/{count}")
    public Boolean save(@PathVariable("userId") String userId,
                        @PathVariable("productId") String productId,
                        @PathVariable("count") Integer count,
                        @RequestParam("userKey")String userKey,
                        @CookieValue(value = "token",required = false)String token
                        ){
        System.out.println("userKey = " + userKey);
        System.out.println("token = "+ token);
        return orderService.saveOrder(userId, productId, count);
    }

}
